﻿using System.Collections.ObjectModel;

namespace MiniFox.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    public class ProviderSettingsCollection : KeyedCollection<string, ProviderSettings>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override string GetKeyForItem(ProviderSettings item)
        {
            return item.Name;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="providerSettings"></param>
        /// <returns></returns>
        public static implicit operator List<Type>(ProviderSettingsCollection providerSettings)
        {
            if (providerSettings == null)
                return null;
            List<Type> typeList = new List<Type>();
            foreach (ProviderSettings providerSetting in providerSettings)
            {
                typeList.Add(providerSetting);
            }
            return typeList;
        }
    }
}
